Skip to content

refactor(api-docs): remove redux and split into docs, playground and shared packages - #128

Open
arpit-bruno wants to merge 73 commits into
usebruno:release/v0.6.0from
arpit-bruno:refactor/playground-without-redux
Open

arpit-bruno wants to merge 73 commits into
usebruno:release/v0.6.0from
arpit-bruno:refactor/playground-without-redux

Conversation

@arpit-bruno

@arpit-bruno arpit-bruno commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

@coderabbitai ignore

Ref BRU-4102

Do not merge or deploy until the builder change is live (hashed api-playground-*.js immutable and never deleted, api-docs.* short cache). Otherwise browsers with a cached api-docs.js ask for a deleted playground file.

Redux removal

  • Removed Redux from api-docs (@reduxjs/toolkit, react-redux, src/store, the @slices alias)
  • State has one owner per piece: read-only document, per-instance session (theme, env, playground view), workspace (playground edits, responses, run state)
  • Small observable on useSyncExternalStore instead of a store, no new dependency
  • Components get props and callbacks instead of reading a global store
  • Collection hydrated once per load; folder toggle no longer rebuilds the nav model
  • One behaviour change: playground edits show on docs pages until reload (changeset: minor)

Split into three packages (BRU-4102)

  • @usebruno/api-docs: docs view, dock shell, CDN entry, e2e
  • @usebruno/api-playground (private): playground, request runner, scripting
  • @usebruno/api-shared (private): session, document, theme, shared UI and helpers
  • Lint-enforced boundaries: shared imports neither, playground never imports docs, docs only type-imports playground
  • Each package declares its own dependencies and is linted against its own package.json; 7 unused deps removed
  • api-docs.js 8.5 MB → 4.8 MB; the playground loads on first "Try it" as api-playground-<hash>.js, once per page
  • Bruno.apiDocs, window.OpenCollection, CSS and entry file names unchanged
  • @/ alias now only in docs; shared and playground use package-name imports
  • Render modes: docs + playground (default, unchanged); docs only with hidePlayground: true (the playground file is never downloaded); playground only is not part of this PR (BRU-4789)

Tests

  • Added before changing anything: standalone bundle lifecycle, updateCollection/updateOptions, loading inputs, env after reload, two instances, what survives close/reopen
  • Exported HTML regression test (old and new generator templates, recorded before the split)
  • Lazy-load tests: no playground request before Try, one after, deep link, two instances, failed load retries, CSP nonce, never loaded with hidePlayground
  • Old lint debt in moved files fixed in place (types only) so CI lint stays at 0

Standards

  • Added CODING_STANDARDS.md, ARCHITECTURE.md, AGENTS.md, root CLAUDE.md (imports AGENTS.md), .coderabbit.yaml
  • no-explicit-any is an error on changed lines; file naming rule (PascalCase components, camelCase rest, kebab e2e)
  • contributing.md: PRs target the active release/vX.Y.0 branch

Checked

  • typecheck (3 packages), 2286 unit tests, lint + CI-mode lint, builds, 382 targeted e2e + 50 standalone e2e, browser walkthrough

…opencollection and pass git url and source text to appshell as props, delete the app slice
… so a folder toggle no longer rebuilds the nav model, and build the uuid to slug map once in the nav model
…ook in opencollection that owns the loaded document
…th its nav model through a document context, delete the docs slice
… collapse across close, reopen, dock switch and updatecollection
…e per-instance session so they still survive close
… session instead of isCollapsed on the items, carried over on re-seed as before
…callbacks instead of dispatching, still backed by redux
…responses and run starts; delete the playground slice and the now empty store
… loading the bundle cross-origin without cors
…t of runner and playground so shared code stops importing them
…itest and typecheck, run tests and typecheck across workspaces in ci
…s from env label specs and the playground header comment
…und and lazy-load it from the docs dock shell as @usebruno/api-playground
…nd, playground never imports docs, and docs only type-imports the playground
…t reads react, router and the shared context modules from Bruno.__rt
…yground file on first open instead of bundling it into api-docs.js
…ep link, once per page, and that a missing file shows the load error
…y, the playground cdn load and the builder cache requirement, and repoint every moved path
…d file stops bundling a second prism that rewrites docs snippets on open
…wo api-docs copies sharing globals, and the amd currentScript fallback
…and lint every package against its own package.json
@arpit-bruno arpit-bruno changed the title remove redux from api-docs and add coding standards for people and agents remove redux, split api-docs into docs, playground and shared packages, add coding standards Nov 13, 2026
@arpit-bruno arpit-bruno changed the title remove redux, split api-docs into docs, playground and shared packages, add coding standards refactor(api-docs): remove redux and split into docs, playground and shared packages (BRU-4102) Nov 13, 2026
@arpit-bruno arpit-bruno changed the title refactor(api-docs): remove redux and split into docs, playground and shared packages (BRU-4102) refactor(api-docs): remove redux and split into docs, playground and shared packages Nov 13, 2026
@arpit-bruno arpit-bruno added run-integrations-matrix-tests run the full framework x node matrix on this PR do-not-merge labels Nov 13, 2026
@arpit-bruno
arpit-bruno marked this pull request as ready for review November 13, 2026 00:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge run-integrations-matrix-tests run the full framework x node matrix on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant